package com.dai.zhenfujin.utils;

import android.util.Log;

public final class LogUtils {
    public static final String LOG_TAG ="fang";
    public static final int LEVEL_DEBUG =0;
    public static final int LEVEL_INFO =1;
    public static final int LEVEL_ERR =2;

    private static final int PRINT_LEVEL =0;

    // 是否打印日志
    private static  boolean hasPrintLog(int level){
        if(level > PRINT_LEVEL) {
            return true;
        }
        return false;
    }

    public static void  d(String msg){
        if(hasPrintLog(LEVEL_DEBUG)){
            Log.d(LOG_TAG,msg);
        }
    }
    public static void  d(String msg,Throwable e){
        if(hasPrintLog(LEVEL_DEBUG)){
            Log.d(LOG_TAG,msg,e);
        }
    }
    public static void  i(String msg){
        if(hasPrintLog(LEVEL_INFO)){
            Log.d(LOG_TAG,msg);
        }
    }
    public static void  i(String msg,Throwable e){
        if(hasPrintLog(LEVEL_INFO)){
            Log.d(LOG_TAG,msg,e);
        }
    }

    public static void  e(String msg){
        if(hasPrintLog(LEVEL_ERR)){
            Log.d(LOG_TAG,msg);
        }
    }
    public static void  e(String msg,Throwable e){
        if(hasPrintLog(LEVEL_ERR)){
            Log.d(LOG_TAG,msg,e);
        }
    }
}
